package com.label.Model.Do;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;

@TableName(value = "activity_data")
@Data
public class Activity {

    @TableId(value = "activity_id",type = IdType.ASSIGN_UUID)
    private String id;

    @TableField(value = "activity_name")
    private String name;

    @TableField(value = "org_name")
    private String orgId;

    @TableField(value = "org_level")
    private String orgLevel;

    @TableField(value = "org_starttime")
    @JsonFormat( pattern = "yyyy-MM-dd" )
    private Date orgStartTime;

    @TableField(value ="org_endtime")
    @JsonFormat( pattern = "yyyy-MM-dd" )
    private Date orgEndTime;

    @TableField(value ="org_tid")
    private String orgTid;

    @TableField(value = "org_sid")
    private String orgSid;

    @TableField(value = "strategy_id")
    private String strategyId;

    @TableField(value = "category_id")
    private String categoryId;

    @TableField(exist = false)
    private List<Tag> tags;

    @TableField(exist = false)
    private Strategy strategy;

    @JsonProperty
    private String strategyName() {
        if(strategy!=null)
            return strategy.getName();
        return null;
    }

}
